<template>
  <div class='gn-foot'>
    <div class="gn-foot-left">
      <div class="nav">
        <swiper :options="swiperOption" ref="mySwiper" class="gn-swiper" v-if="banner.length>0">
          <swiper-slide v-for='(item,index) in banner' :key='index'>
            <a :href="keyUrl+item.url">
              <div class="page">
                <img :src="keyUrl+(item.image.replace('-lp',''))" alt="">
                <span>{{item.title}}</span>
              </div>
            </a>
          </swiper-slide>
          <div class="swiper-pagination" slot="pagination"></div>
          <div class="swiper-button-prev" slot="button-prev"></div>
         <div class="swiper-button-next" slot="button-next"></div>
        </swiper>
      </div>
      <div class="new-wrap">
        <div class="left">
          <ul>
            <li v-for='(item,index) in pic1' :key='index'>
              <a :href="keyUrl+item.url">
              <p>{{item.title}}</p>
              <div class="bottom">
                <img :src="keyUrl+item.image" alt="">
                <span>{{item.contents}}...</span>
              </div>
            </a></li>
          </ul>
        </div>

        <div class="right">
          <p>图集</p>
          <div class="box">
              <a class="item" v-for='(item,index) in pic2' :key='index' :href='keyUrl+item.url'>
                  <img :src="keyUrl+item.image" alt="">
              </a>
            </div>
        </div>
      </div>
    </div>
    <div class="gn-foot-right">
      <ul>
        <li v-for='(item,index) in mains' :key='index'>
          <a :href="keyUrl+item.url">
          {{item.title}}
        </a></li>
      </ul>
    </div>
  </div>
</template>

<script>
  import { getgnFootBanner,getgnFootMain,getgnFootPic} from '@/request/api'
  import {
    swiper,
    swiperSlide
  } from 'vue-awesome-swiper'

  export default {
    components: {
      swiper,
      swiperSlide
    },

    data() {
      return {
        swiperOption: { //swiper3
          autoplay: {
            delay: 1500,
            disableOnInteraction: true
          },
          observeParents: true,
          observer: true,
          speed: 1000,
          loop: true,
          watchOverflow: false,
          speed: 1000,
          //direction: 'vertical',
          //mousewheel: true,
          pagination: {
            el: '.swiper-pagination',
            clickable: true
          },
          navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev'
          }
        },
        banner:[],
        mains:[],
        pic1:[],
        pic2:[]

      };
    },
    computed: {
      swiper() {
        return this.$refs.mySwiper.swiper
      }
    },
    methods: {

    },
    created(){
      getgnFootBanner().then((v)=>{
        this.banner = v.data;
      })
      getgnFootMain().then((v)=>{
        this.mains = v.data.slice(0,26)
      })
      getgnFootPic().then((v)=>{
        this.pic1 = v.data.slice(0,2)
        this.pic2 = v.data.slice(2,8)
      })
    },
    mounted() {
      // current swiper instance
      // 然后你就可以使用当前上下文内的swiper对象去做你想做的事了
      //this.swiper.slideTo(0, 555000, false)
    }
  };

</script>

<style lang='scss' scoped>
  .gn-foot {
    display: flex;
    justify-content: space-between;
    .gn-foot-left{
      width: 826px;
    }
    .gn-foot-right{
      width: 325px;
      li:first-child a{
        font-size:16px;
        font-weight:bold;
        color:#C52215;
        line-height:20px;
        padding-top: 0;
      }
      li a{
        display: block;
        font-size:13px;
        font-weight:400;
        color:rgba(63,63,63,1);
        line-height:18px;
        padding-top: 15px;
        width: 100%;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        &:hover{
          color:#C52215;
        }
      }
    }
    .nav {
      .gn-swiper {
        width:826px;
        height:400px;

        .page {
          position: relative;
          padding-bottom: 60px;

          img {
            width:826px;
            height:400px;
          }

          span {
            display: block;
            width: 96%;
            padding:0 2%;
            height: 60px;
            background: rgba(0, 0, 0, .7);
            font-size: 18px;
            font-family: Microsoft YaHei;
            color: rgba(255, 255, 255, 1);
            line-height: 60px;
            text-align: left;
            position: absolute;
            bottom: 60px;
            left: 0;
/*            z-index: 9999;*/
          }
        }
      }
    }

    .new-wrap {
      display: flex;
      justify-content: space-between;
      margin-top: 30px;

      .left {
        width: 460px;
        ul {
          li a{
            display: block;
            width: 100%;
            height: 184px;
            border-bottom: 1px #DCDCDC solid;
            overflow: hidden;
            &:hover{
              .bottom span{
                color:#C52215;
              }
            }
            p {
              font-size: 16px;
              font-family: Microsoft YaHei;
              color:#C52215;
              line-height: 60px;
              font-weight: bold;
            }
            .bottom {
              display: flex;

              img {
                width: 150px;
                height: 100px;
                margin-right: 20px;
              }

              span {
                width: 286px;
                font-size: 13px;
                color: rgba(51, 51, 51, 1);
                line-height: 26px;
              }

            }
          }
        }
      }

      .right {
        width: 350px;

        p {
          font-size: 16px;
          font-family: Microsoft YaHei;
          color: #C52215;
          line-height: 60px;
          font-weight: bold;
        }

        .box {
          display: flex;
          flex-wrap: wrap;
          justify-content: space-between;

          .item {
            width: 170px;
            height: 100px;
            position: relative;
            margin-bottom: 12px;

             span {
              font-size: 13px;
              font-family: Microsoft YaHei;
              font-weight: 400;
              color: rgba(255, 255, 255, 1);
              position: absolute;
              left: 20px;
              bottom: 6px;
            }

            img {
                width: 170px;
            height: 100px;

            }

          }
        }
      }
    }

    .gn-swiper /deep/ {
      .swiper-pagination-bullet-active {
        background: #F4F4F4 !important;
      }

    .swiper-pagination{
      text-align: right;
    }
    .swiper-pagination-bullets{
      bottom: 20px;
    }
    .swiper-pagination-bullet{
      margin: 0 10px 0 0;
      background: #fff;
    }
    .swiper-button-next {
      background-image: url('../assets/img/right.png');
    }
    .swiper-button-prev {
      background-image: url('../assets/img/left.png');
    
    }
  }

  }

</style>
